package com.maxd.service.helpTask;

import com.maxd.error.Result;
import com.maxd.error.ResultUtil;
import com.maxd.model.HelpTakeOrder;
import com.maxd.model.HelpTask;
import com.maxd.respository.helpTask.HelpTakeOrderJpaRepository;
import com.maxd.respository.helpTask.HelpTakeOrderRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;

/**
 * 派单信息
 */
@Service
public class HelpTakeOrderServiceImpl implements HelpTakeOrderService {

    /** 派单信息 */
    @Autowired
    private HelpTakeOrderJpaRepository helpTakeOrderJpaRepository;
    /** 派单信息自定义方法 */
    @Autowired
    private HelpTakeOrderRepository helpTakeOrderRepository;

    @Override
    public Result saveBody(HelpTakeOrder helpTakeOrder) {
        helpTakeOrderJpaRepository.save(helpTakeOrder);
        return ResultUtil.success();
    }

    @Override
    public HelpTakeOrder selectHelpTakeOrderByHelpTaskId(Long helpTaskId) {
        return helpTakeOrderRepository.selectHelpTakeOrderByHelpTaskId(helpTaskId);
    }

    @Override
    public Integer selectCountByHelpTaskIdAndUserId(Long helpTaskId, Long userId) {
        return helpTakeOrderRepository.selectCountByHelpTaskIdAndUserId(helpTaskId,userId);
    }

    @Override
    public HelpTakeOrder selectById(Long helpTakeOrderId) {
        return helpTakeOrderRepository.selectById(helpTakeOrderId);
    }
}